package demo.java.lang;

import org.junit.Test;

public class CharacterDemo {

    public static final char del = 127;// ASCII码删除符

    public static final String FieldDelimit = "\u007F";// 字段分隔符，007F是unicode的127，表示删除符

    /**
     * 用JAVA自带的函数
     *
     * @param str
     * @return
     */
    public static boolean isNumeric(String str) {
        for (int i = str.length(); --i >= 0; ) {
            if (!Character.isDigit(str.charAt(i))) {
                return false;
            }
        }
        return true;
    }

    @Test
    public void testCharacter() {
        for (byte a = 0; a < Byte.MAX_VALUE; a++) {
            System.out.println(a + " = " + (char) a);
        }

        byte b = 42;
        System.out.println(b + " = " + (char) b);

        b = 36;
        System.out.println(b + " = " + (char) b);

        char c = '\r';
        System.out.println(c + " = " + (byte) c);
        c = '\n';
        System.out.println(c + " = " + (byte) c);

    }
}
